package com.syyai.spring.boot.starter.demo.urule;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletRequest;

import com.bstek.urule.console.EnvironmentProvider;
import com.bstek.urule.console.Principal;
import com.bstek.urule.console.servlet.RequestContext;
import com.syyai.spring.boot.starter.demo.util.RequestUtil;

/**
 * 
 * @author yongjie0203@126.com
 *
 */
public class URuleProEnvironmentProvider implements EnvironmentProvider {

	@Override
	public Principal getLoginPrincipal(RequestContext arg0) {
		// TODO Auto-generated method stub
		ServletRequest request =	RequestUtil.getServletRequest();
		if(null == request) {
			return null;
		}
		User user = (User) request.getAttribute("user");
		return user;
	}

	@Override
	public List<Principal> getPrincipals() {
		List<Principal> list  = new ArrayList<Principal>();
		
		return null;
	}

}
